]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
runDialog: Fix launching shell command in terminal
authorBalló György <ballogyor@gmail.com>
Mon, 31 Mar 2025 15:12:36 +0000 (17:12 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 16 Apr 2025 19:17:43 +0000 (21:17 +0200)
At one point Clutter became stricter when handling keybindings,
and the text's `activate` signal is no longer emitted when
additional modifiers are pressed.

To fix launching a command in the terminal when activating
with ctrl, make the entry non-activatable and move activation
to a `key-press-event` handler.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7516
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3683>

js/ui/runDialog.js

index 7e32d74bb12fa95573d9ea7e53055c9351f38dc9..1ce9fe2e23ff12bb5b0236def1fc39c78444c158 100644 (file)
@@ -70,6 +70,7 @@ class RunDialog extends ModalDialog.ModalDialog {
         ShellEntry.addContextMenu(entry);
 
         this._entryText = entry.clutter_text;
+        this._entryText.activatable = false;
         content.add_child(entry);
         this.setInitialKeyFocus(this._entryText);
 
@@ -90,14 +91,6 @@ class RunDialog extends ModalDialog.ModalDialog {
             gsettingsKey: HISTORY_KEY,
             entry: this._entryText,
         });
-        this._entryText.connect('activate', o => {
-            this.popModal();
-            this._run(o.get_text(),
-                Clutter.get_current_event().get_state() & Clutter.ModifierType.CONTROL_MASK);
-            if (!this._commandError ||
-                !this.pushModal())
-                this.close();
-        });
         this._entryText.connect('key-press-event', (o, e) => {
             let symbol = e.get_key_symbol();
             if (symbol === Clutter.KEY_Tab) {
@@ -113,6 +106,14 @@ class RunDialog extends ModalDialog.ModalDialog {
                     o.set_cursor_position(text.length + postfix.length);
                 }
                 return Clutter.EVENT_STOP;
+            } else if ([Clutter.KEY_Return, Clutter.KEY_KP_Enter, Clutter.KEY_ISO_Enter].includes(symbol)) {
+                this.popModal();
+                this._run(o.get_text(),
+                    Clutter.get_current_event().get_state() & Clutter.ModifierType.CONTROL_MASK);
+                if (!this._commandError ||
+                    !this.pushModal())
+                    this.close();
+                return Clutter.EVENT_STOP;
             }
             return Clutter.EVENT_PROPAGATE;
         });